<template>
	<view class="waterfall-item-container">
		<view class="waterfall-item" @click="onTap(item)">
			<image class="item-image" v-if="item.cover_url" :src="item.cover_url" mode="widthFix"></image>
			<image v-else class="no-image-view-waterfall-item" src="@/static/zanwutupian.png" mode="widthFix"></image>
			<view class="item-text-view-box">
				<view class="waterfall-item-title" v-if="item.model_has_one">{{item.model_has_one.name}}</view>
				<view class="item-content-box">
					<view class="item-content-text" v-if="item.registration_time">
						{{item.registration_time.split('-')[0]}}-{{item.registration_time.split('-')[1]}}
					</view>
					<view class="shu-line" v-if="item.registration_time"></view>
					<view class="item-content-text" v-if="item.standard_has_one">{{item.standard_has_one.name}}</view>
					<view class="shu-line" v-if="item.standard_has_one"></view>
					<view class="item-content-text">{{item.mileage}}</view>
					<view class="shu-line" v-if="item.province_has_one"></view>
					<view class="item-content-text" v-if="item.province_has_one">{{item.province_has_one.name}}</view>
				</view>
				<view class="item-price-box">
					<view class="item-content-box" style="margin-left: 20rpx;">
						<view class="item-text-price">{{item.price.split('万')[0]}}</view>
						<view class="item-text-wan" style="margin-left: 4rpx;">万</view>
					</view>
					<view class="item-content-text">{{item.create_time}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "helangWaterfallItem",
		options: {
			virtualHost: true
		},
		props: {
			item: {
				type: Object,
				default () {
					return {}
				}
			},
			tag: {
				type: String | Number,
				default: ''
			},
			index: {
				type: Number,
				default: -1
			}
		},
		data() {
			return {

			};
		},
		methods: {
			onTap(data) {
				this.$emit("itemOnClick", data);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.waterfall-item {
		padding: 0rpx 12rpx 12rpx 12rpx;
		background-color: #fff;
		border-radius: 10px;
		font-size: 28rpx;
		color: #666;

		image {
			display: block;
			width: 100%;
			// 默认设置一个图片的大约值
			height: 350rpx;
		}
	}

	.shu-line {
		width: 0rpx;
		height: 16rpx;
		border: 1px solid #E3E3E3;
		opacity: 1;
		margin: 5rpx 0rpx;
	}

	.item-image {
		width: 100%;
		max-height: 400rpx;
		border-radius: 10rpx;
		background: #F2F2F2;
		opacity: 1;
		margin: 16rpx 0rpx;
	}

	.no-image-view-waterfall-item {
		width: 106rpx;
		height: 112rpx;
		border-radius: 10rpx;
		background: #F2F2F2;
		opacity: 1;
		margin: 16rpx 0rpx;
	}

	.item-view-box {}

	.waterfall-item-title {
		flex: 1;
		text-align: left;
		margin-bottom: 10rpx;
		font-size: 28rpx;
		font-family: Source Han Sans SC;
		font-weight: 500;
		color: #000026;
		margin-top: 8rpx;
	}

	.item-content-box {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.item-content-text {
		font-size: 22rpx;
		font-family: Source Han Sans SC;
		font-weight: 400;
		color: #AAAAAA;
		opacity: 1;

	}


	.item-price-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin: 10rpx 0rpx;
	}

	.item-text-price {
		font-size: 32rpx;
		font-family: DIN Alternate;
		font-weight: bold;
		line-height: 0rpx;
		color: #EC4B4B;
		opacity: 1;
	}

	.item-text-wan {
		font-size: 20rpx;
		font-family: Source Han Sans SC;
		font-weight: 400;
		line-height: 0rpx;
		color: #EC4B4B;
		opacity: 1;
	}

	.item-time {}

	.item-text-view-box {}
</style>